package day16;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by kunsb on 2016/11/3.
 */
public class SystemTime {
    public static void main(String[] args) {
        Date date = new Date();
        System.out.println(date);
        System.out.println(date.getTime());
        date.setTime(0L);
        System.out.println(date);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString = sdf.format(date);
        System.out.println(dateString);
        try {
            Date parse = sdf.parse(dateString);
            System.out.println(parse);
        } catch (ParseException e) {
            e.printStackTrace();
        }


        //时间long值： 代表从1970-01-01 00:00:00 （UTC）
        System.out.println(System.currentTimeMillis());
    }
}
